package java_9_16zy.Test_2;


import java.io.*;
import java.util.*;

public class Test_2tt {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        List l1=new ArrayList();
        Caipiao c=null;
        Caipiao c1=null;
        System.out.println("请输入红球数字");
        int i1=0;
        while (i1<6){
            int i = in.nextInt();
            if ((i<1||i>33)||l1.contains(i)){
                System.out.println("您输入了错误数字，请重新输入");
                continue;
            }else {
                l1.add(i);
                i1++;
                break;
            }
        }
        while (i1<1){
            int b=in.nextInt();
            if (b<1||b>16){
                System.out.println("您输入了错误数字，请重新输入");
                continue;
            }else{
                 c=new Caipiao(b,l1);
                 c1.cc(c);
                i1++;
                break;
            }
        }

        List l=new ArrayList();
        Random r=new Random();
        ObjectInputStream o=null;
        ObjectOutputStream o1=null;

        try {
            o=new ObjectInputStream(new FileInputStream("D:\\第一小组\\zpc.txt"));
              c1=(Caipiao)o.readObject();
        } catch (Exception e) {
            e.printStackTrace();
            while (l.size()<6){
                int i2 = r.nextInt(33)+1;
                if (!(l.contains(i2))){
                    l.add(i2);
                }
            }
            Collections.sort(l);
            int i = r.nextInt(16) + 1;
             c1=new Caipiao(i,l);
            try {
                o1=new ObjectOutputStream(new FileOutputStream("D:\\第一小组\\zpc.txt"));
                o1.writeObject(c1);
            } catch (IOException e1) {
                e1.printStackTrace();
            }
        }finally {
            try {
                o.close();
                o1.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
